home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / newsgroups / misc.20041116-20060924 / 000216_fdc@columbia.edu_Thu Dec 1 15:43:02 2005.msg < prev    next >
Internet Message Format  |  2006-09-27  |  2KB

  1. Path: newsmaster.cc.columbia.edu!not-for-mail
  2. From: Frank da Cruz <fdc@columbia.edu>
  3. Newsgroups: comp.protocols.kermit.misc
  4. Subject: Re: Take command exiting...
  5. Date: 1 Dec 2005 20:42:35 GMT
  6. Organization: Columbia University
  7. Lines: 35
  8. Message-ID: <slrndouo1r.glb.fdc@sesame.cc.columbia.edu>
  9. References: <1133384455.038767.79060@o13g2000cwo.googlegroups.com> <slrndos597.2sq.fdc@sesame.cc.columbia.edu> <1133386372.686029.66160@g47g2000cwa.googlegroups.com> <1133415677.052842.20950@f14g2000cwb.googlegroups.com> <1133468058.066993.41880@g14g2000cwa.googlegroups.com>
  10. Reply-To: fdc@columbia.edu
  11. NNTP-Posting-Host: sesame.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1133469755 22244 128.59.59.56 (1 Dec 2005 20:42:35 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 1 Dec 2005 20:42:35 GMT
  15. User-Agent: slrn/0.9.8.0 (SunOS)
  16. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:15463
  17.  
  18. On 2005-12-01, malone <malonespam@cox.net> wrote:
  19. : Ok I understand what you are saying. I will have to try that.
  20. :
  21. : another question:
  22. : is there a way to monitor keyboard activity during a script?
  23. :
  24. : i know it monitors the ctrl-C but can i monitor other keys like 'A' or
  25. : 'V' maybe using the \v(kbchar) or kbhit ?
  26. :
  27. Off the top of my head:
  28.  
  29.   IF KBHIT <command>
  30.   SET INPUT CANCELLATION ON  ; lets you interrupt INPUT from the keyboard
  31.   SET PAUSE CANCELLATION ON  ; lets you interrupt PAUSE/SLEEP from the keyboard
  32.   Ctrl-C can be trapped by a macro called ON_CTRLC
  33.   
  34. Any command that times out, like PAUSE, SLEEP, or INPUT, can be interrupted by
  35. a keystroke if the corresponding SET xxx CANCELATION is ON, and the character
  36. that was typed is available in \v(kbhit).  Let's see, what else...
  37.  
  38. Commands like ASK and GETC and GETOK can be told to time out.  So, for
  39. example, you can do something like this:
  40.  
  41.   set ask-timer 10
  42.   getc \%c "Press any key within 10 seconds to quit:"
  43.   set ask-timer 0
  44.   echo
  45.   if asktimeout {
  46.       echo Continuing...
  47.   } else {
  48.       echo You typed: \%c
  49.       end
  50.   }
  51.  
  52. - Frank